Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add network config devices #700

Merged
merged 6 commits into from
Nov 8, 2024
Merged

Add network config devices #700

merged 6 commits into from
Nov 8, 2024

Conversation

vinc
Copy link
Owner

@vinc vinc commented Nov 6, 2024

  • Add net-gw device
  • Add net-ip device
  • Add net-mac device
  • Add net-usage device

@vinc
Copy link
Owner Author

vinc commented Nov 6, 2024

We can now configure the network manually from userspace:

net-dev

@vinc
Copy link
Owner Author

vinc commented Nov 7, 2024

The format for /dev/net/usage is: <recv packets> <recv bytes> <sent packets> <sent bytes>

~
> dhcp
[248.908097] NET IP 10.0.2.15/24
[248.916096] NET GW 10.0.2.2
[248.926094] NET DNS 10.0.2.3

~
> read /dev/net/usage
2 1180 2 620

~
> http example.com => /dev/null

~
> read /dev/net/usage
10 3312 10 1151

@vinc
Copy link
Owner Author

vinc commented Nov 7, 2024

The failing test on the previous commit due to memory allocation failure was weird.

@vinc
Copy link
Owner Author

vinc commented Nov 8, 2024

The device system could be refactored to be more hierarchical in the future instead of having just one big flat enum. For example all the net-* devices could be grouped into a virtual net device, sharing the same first byte on the device file, and then the second byte of the file would be used by the net module to dispatch the IO commands to the right IO NET device.

The ATA devices already use the next two bytes for the bus and drive numbers so there's a precedent for that.

@vinc
Copy link
Owner Author

vinc commented Nov 8, 2024

We'll need a way to monitor all network traffic and enable/disable the debug mode before removing the net command completely.

@vinc vinc marked this pull request as ready for review November 8, 2024 09:31
@vinc vinc merged commit 92055d5 into trunk Nov 8, 2024
1 check passed
@vinc vinc deleted the feature/net-dev branch November 8, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant